Skip to content

[#63717] Filterable tree view - #321

Merged
HDinger merged 28 commits into
mainfrom
filterable_tree_view
Aug 12, 2025
Merged

[#63717] Filterable tree view#321
HDinger merged 28 commits into
mainfrom
filterable_tree_view

Conversation

@camertron

@camertron camertron commented Jun 11, 2025

Copy link
Copy Markdown
Collaborator

What are you trying to accomplish?

This PR introduces the FilterableTreeView component, which is a TreeView and associated filter controls that allow searching a hierarchy for desired items. FilterableTreeView can be used both inside and outside the context of a Rails form, making user selections easy to submit to the backend.

This PR also includes several updates to the TreeView component, namely:

  1. The ability to disable nodes. Disabled nodes cannot be activated, but are still focusable so as to be friendly to screen readers.
  2. The descendants select mode has been renamed mixed_descendants. The select mode now named descendants behaves slightly differently from its predecessor in that nodes are always either checked ("true") or unchecked ("false") and are never in an indeterminate/mixed state. The goal here was to allow treating sub-tree nodes as selectable entities in their own right rather than simply part of the hierarchy.

Remaining tasks:

  • Tests for check/uncheck behavior, especially when the "Include sub-items" feature is turned on.
  • More robust tests for form submission behavior, eg. when sub-items are automatically checked.
  • Improve previews
    • more previews
    • snapshots
  • Test in browsers besides Chrome
  • Make default labels localized

Screenshots

Alt: The FilterableTreeView component in action. The user shows a hierarchy of Hogwarts houses from the Harry Potter series and the students that lived in them. Features like the "Include sub-items" check box is enabled, demonstrating its effects. Filter text is entered to demonstrate hiding non-matching nodes and text highlighting, and the filter mode control shows that only checked nodes are shown when the "Selected" option is chosen.

Screen.Recording.2025-06-10.at.11.16.02.PM.mov

Integration

No changes necessary in production - everything in this PR should be 100% backwards-compatible.

List the issues that this change affects.

Closes #63717

Risk Assessment

  • Low risk the change is small, highly observable, and easily rolled back.

Accessibility

  • No new axe scan violation - This change does not introduce any new axe scan violations.

Merge checklist

  • Added/updated tests
  • Added/updated documentation
  • Added/updated previews (Lookbook)
  • Tested in Chrome
  • Tested in Firefox
  • Tested in Safari
  • Tested in Edge

@changeset-bot

changeset-bot Bot commented Jun 11, 2025

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 70ed74d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@openproject/primer-view-components Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions

github-actions Bot commented Jun 11, 2025

Copy link
Copy Markdown

⚠️ Visual or ARIA snapshot differences found

Our visual and ARIA snapshot tests found UI differences. Please review the differences by viewing the files changed tab to ensure that the changes were intentional.

Review differences

@HDinger
HDinger force-pushed the filterable_tree_view branch from 2efce77 to a084f24 Compare August 12, 2025 07:59
@HDinger
HDinger force-pushed the filterable_tree_view branch from a084f24 to 1c7bb7e Compare August 12, 2025 08:11

@HDinger HDinger left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🥳 🎉

@HDinger
HDinger marked this pull request as ready for review August 12, 2025 11:04
@HDinger
HDinger merged commit 5abcf60 into main Aug 12, 2025
2 checks passed
@HDinger
HDinger deleted the filterable_tree_view branch August 12, 2025 11:06
@openprojectci openprojectci mentioned this pull request Aug 12, 2025
@HDinger

HDinger commented Aug 12, 2025

Copy link
Copy Markdown
Collaborator

The performance will need some improvements before we can use that for long lists. A quick test with ~7500 items needed approx 9s. However, the reason is more in the TreeView itself which needs 7s for 7500 items.
I created https://community.openproject.org/wp/66508 for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants